package nape.space;
import zpp_nape.Config;
import zpp_nape.Const;
import zpp_nape.util.Flags;
import DummyNapeMain;
import zpp_nape.util.Math;
import zpp_nape.util.Names;
import zpp_nape.util.Pool;
import zpp_nape.util.Lists;
import zpp_nape.shape.Circle;
import zpp_nape.shape.Edge;
import zpp_nape.space.Space;
import zpp_nape.shape.Polygon;
import zpp_nape.shape.Shape;
import zpp_nape.phys.FeatureMix;
import zpp_nape.phys.FluidProperties;
import zpp_nape.phys.Material;
import zpp_nape.phys.Body;
import zpp_nape.geom.AABB;
import zpp_nape.geom.Distance;
import zpp_nape.geom.Mat23;
import zpp_nape.geom.Vec2;
import zpp_nape.geom.VecMath;
import zpp_nape.geom.Collide;
import zpp_nape.dynamics.Arbiter;
import zpp_nape.dynamics.Contact;
import zpp_nape.dynamics.InteractionFilter;
import zpp_nape.constraint.Constraint;
import zpp_nape.dynamics.SpaceArbiterList;
import zpp_nape.constraint.Matrices;
import zpp_nape.constraint.PivotJoint;
import zpp_nape.constraint.WeldJoint;
import nape.util.Flags;
import nape.util.Lists;
import nape.util.Debug;
import nape.shape.Circle;
import nape.shape.Polygon;
import nape.shape.Edge;
import nape.shape.Shape;
import nape.phys.FluidProperties;
import nape.phys.Material;
import nape.phys.Body;
import nape.geom.AABB;
import nape.geom.Geom;
import nape.geom.Mat23;
import nape.geom.Vec2;
import nape.dynamics.Contact;
import nape.dynamics.Arbiter;
import nape.dynamics.InteractionFilter;
#if swc@:keep#end class Space{
    public var zpp_inner:ZPP_Space;
    public var gravity(flibget_gravity,flibset_gravity):Vec2;
    inline function flibget_gravity(){
        if(zpp_inner.wrap_gravity==null)zpp_inner.getgravity();
        return zpp_inner.wrap_gravity;
    }
    inline function flibset_gravity(gravity:Vec2)return this.gravity.set(gravity)public var bodies(flibget_bodies,never):BodyList;
    inline function flibget_bodies()return zpp_inner.wrap_bodies public var statics(flibget_statics,never):BodyList;
    inline function flibget_statics()return zpp_inner.wrap_statics public var dynamics(flibget_dynamics,never):BodyList;
    inline function flibget_dynamics()return zpp_inner.wrap_dynamics public var kinematics(flibget_kinematics,never):BodyList;
    inline function flibget_kinematics()return zpp_inner.wrap_kinematics public var liveBodies(flibget_liveBodies,never):BodyList;
    inline function flibget_liveBodies()return zpp_inner.wrap_live public var arbiters(flibget_arbiters,never):ArbiterList;
    inline function flibget_arbiters(){
        if(zpp_inner.wrap_arbiters==null){
            var ret=new ZPP_SpaceArbiterList();
            ret.space=zpp_inner;
            zpp_inner.wrap_arbiters=ret;
        }
        return zpp_inner.wrap_arbiters;
    }
    #if swc@:keep#end public inline function step(deltaTime:Float,?elasticIterations:Int=10,?stackingIterations:Int=10){
        if(deltaTime<=0)throw "Error: deltaTime must be strictly positive";
        if(elasticIterations<0)throw "Error: cannot use negative number of elastic iterations";
        if(stackingIterations<=0)throw "Error: must use atleast one stacking iteration";
        zpp_inner.step(deltaTime,elasticIterations,stackingIterations);
    }
    public function new(?gravity:Vec2){
        zpp_inner=new ZPP_Space(gravity==null?null:gravity.zpp_inner);
        zpp_inner.outer=this;
    }
}
